<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="vue.js"></script>
</head>

<body>
    <div id="root">
        请输入张三的成绩：<input type="text" v-model="result" placeholder="按下回车查看等级" @keyup.Enter="showResult"
            onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')">

        <!-- <button @click="showResult">33</button> -->
        <div v-if="x">
            <div v-if="result>=90 && result&lt;=100">
                <h1>张三的成绩优秀</h1>
            </div>
            <div v-if="result>=75 && result&lt;90">
                <h1>张三的成绩良好</h1>
            </div>
            <div v-if="result>=60 && result&lt;75">
                <h1>张三的成绩及格</h1>
            </div>
            <div v-if="0&lt;=result && result&lt;60">
                <h1>张三的成绩不及格</h1>
            </div>
        </div>







    </div>



    </template>
    <script>
        Vue.config.productionTip = false;

        const vm = new Vue({
            el: '#root',
            data: {
                result: '',
                x: false,
            },
            methods: {
                showResult() {
                    this.x = true
                },
                // showResult2() {
                //     this.x = false
                // }
            },
            watch: {
                result() {
                    this.x = false
                }
            }
        })
    </script>
</body>

</html>